#pragma once

#include "log.h"
#include "cprimitive.h"
#include <vector>
using namespace std;

//-------------------------------------------------
// Name:
// Desc:
//-------------------------------------------------
class CManipulator
{
public:
	vector<D3DXVECTOR2*> predefinedPositions;
	int numPredefinedPos;

	vector<cprimitive*> cube;
	D3DXVECTOR3 vDest;

	//field configuration
	D3DXVECTOR3 quadDimensions;
	D3DXVECTOR2 fieldDimensions;

	CManipulator(void);
	~CManipulator(void);

	HRESULT Create(LPDIRECT3DDEVICE9 pd3dDevice);
	HRESULT Release();
	HRESULT FrameMove(float fElapsedTime, float fTime);
	HRESULT Render(LPDIRECT3DDEVICE9 pd3dDevice);

	//setup functions
	HRESULT SetAngles(int index, D3DXVECTOR2 angles);

	//controller functions
	D3DXVECTOR3 MoveTo(int quadrant, int level);
	HRESULT PredefinedPosition(int num);

protected:
	HRESULT DrawChain(cprimitive* pCube, LPDIRECT3DDEVICE9 pd3dDevice);
	HRESULT DrawChain(cprimitive* pCube, LPDIRECT3DDEVICE9 pd3dDevice, D3DXMATRIX matRot, D3DXMATRIX matRotY, D3DXVECTOR3 vecTranslate);
	HRESULT InversedKinematics(D3DXVECTOR3 vecDest);
	HRESULT InitPredefinedPositions();
};
